/**
  ******************************************************************************
  * @file           : test15.c
  * @author         : 35033
  * @brief          : None
  * @attention      : None
  * @date           : 2024/3/13
  ******************************************************************************
  */


#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

int main() {
    int num1 = 0, num2 = 0, i = 0;
    int result;
    printf("请输入三个整数（以空格分隔）：");
    fflush(stdout); // 确保在读取输入前输出已经被发送
    result = scanf("%d%d%d", &num1, &num2, &i);
    if (result != 3) {
        printf("error 输入不合法\n");
        return 1;
    }

    switch (i) {
        case 1:
            printf("%d\n", num1 + num2);
            break;
        case 2:
            printf("%d\n", num1 - num2);
            break;
        case 3:
            printf("%d\n", num1 * num2);
            break;
        case 4:
            if (num2 != 0) {
                printf("%d\n", num1 / num2);
            } else {
                printf("error 除数不能为零\n");
            }
            break;
        default:
            printf("error 未知操作\n");
    }
    return 0;
}
